package data;

import java.util.Hashtable;

import javax.swing.JOptionPane;

import mail_operations.AdvancedOptionDialog;
import mail_operations.MailerGUI;

/**
 * A generalized set of tools that classes can use to check for message sending readiness
 * @author lax116
 *
 */
public class ReportTools {
	//Name of report / report object
	private static Hashtable<String,ReportInterface> reportList = new Hashtable<String,ReportInterface>();
	
	public static boolean check(){
		return false;

	}
	public static boolean checkEmailAbility(boolean supressDialog){
		if(ConfigInfo.SENDER_EMAIL.length()<1){
			if(!supressDialog){
				JOptionPane.showMessageDialog(null, "Sender Email cannot be blank!");
				AdvancedOptionDialog.open();
			}
			return false;
		}else if(ConfigInfo.SERVER_ADDRESS.length()<1){
			if(!supressDialog){
				JOptionPane.showMessageDialog(null, "Server Address cannot be blank!");
				AdvancedOptionDialog.open();
			}
			return false;
		}
/*		if(MailerGUI.getSubject("a", "a").length()<1){
			if(!supressDialog){
				int selection = JOptionPane.showConfirmDialog(null, "Send message without subject?", "No Subject", JOptionPane.OK_CANCEL_OPTION);
				switch(selection){
				case JOptionPane.CANCEL_OPTION:
					MailerGUI.open();
					return false;
				}
			}
		}
		*/
		return true;
	}
	public static  Hashtable<String, ReportInterface> getReportList(){
		return reportList;
	}
	public static void addReport(String name, ReportInterface r){
		reportList.put(name,r);
	}
	public static ReportInterface getReport(String name){
		return reportList.get(name);
	}
}
